
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Maven依赖 Scope解析与冲突解决 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Maven依赖 Scope解析与冲突解决 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">Maven中的默认依赖Scope是什么？它的作用范围是怎样的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">默认的Scope是`compile`。它指定依赖在编译、测试、运行和打包时均可用。</div>
          </div>
          <div class="card-source">来源: 1. Maven 依赖 Scope 介绍</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">`provided` Scope的主要作用是什么？请举一个典型的应用场景。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`provided` Scope表示依赖在编译和测试时可用，但不会被打包到最终的产物中。典型的应用场景是Servlet API，因为像Tomcat/Jetty这样的Web容器在运行时已经提供了该依赖。</div>
          </div>
          <div class="card-source">来源: 1. Maven 依赖 Scope 介绍</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">`runtime` Scope与`compile` Scope有何不同？什么情况下会使用`runtime` Scope？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`runtime` Scope的依赖不会用于编译阶段，但会在运行和测试时可用；而`compile` Scope的依赖在编译、测试、运行和打包时都可用。`runtime` Scope适用于像JDBC驱动这样的库，它们在编译时不需要，但在运行时必须存在。</div>
          </div>
          <div class="card-source">来源: 1. Maven 依赖 Scope 介绍</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在Maven中，`import` Scope有什么特殊的用途？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`import` Scope仅用于`<dependencyManagement>`标签内，其作用是引入一个BOM（Bill of Materials）文件，从而集中管理一组相关依赖的版本。</div>
          </div>
          <div class="card-source">来源: 1. Maven 依赖 Scope 介绍</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">Maven项目中依赖冲突的主要来源有哪些？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">依赖冲突主要有两个来源：1. 直接依赖版本不同，即在pom.xml中直接引入了同一个库的多个不同版本。2. 传递依赖版本不同，即项目依赖的两个不同库各自依赖了同一个库的不同版本。</div>
          </div>
          <div class="card-source">来源: 2. 依赖冲突的来源</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">当遇到依赖冲突时，可以使用哪个Maven命令来分析项目的完整依赖树？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以使用 `mvn dependency:tree` 命令。该命令会输出完整的依赖树，帮助开发者分析哪个依赖引入了冲突的版本。</div>
          </div>
          <div class="card-source">来源: 3.1 使用 dependency:tree 检查依赖</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">如何利用`<dependencyManagement>`来解决Maven依赖冲突问题？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通过在父POM的`<dependencyManagement>`部分统一声明和管理依赖的版本。这样，所有子模块在引用这些依赖时都会使用父POM中锁定的版本，从而避免了版本不一致导致的冲突。</div>
          </div>
          <div class="card-source">来源: 3.2 在 dependencyManagement 中锁定版本</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Maven中的`<exclusions>`标签有什么作用？它如何帮助解决依赖冲突？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`<exclusions>`标签用于在引入某个依赖时，显式地排除掉它所带来的传递性依赖。通过排除掉一个库所依赖的冲突版本（如`common-lib`），可以确保项目中使用的版本不会被覆盖，从而解决版本冲突问题。</div>
          </div>
          <div class="card-source">来源: 3.3 排除冲突依赖</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">`test` Scope的依赖适用于哪些场景？它会被打包到最终的应用程序中吗？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`test` Scope的依赖仅用于测试代码的编译和运行，例如JUnit、Mockito等测试库。这些依赖不会被打包到最终的应用程序中。</div>
          </div>
          <div class="card-source">来源: 1. Maven 依赖 Scope 介绍</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
